#include "precompiled.h"

namespace IcyCrystal {
	SyntaxTree::SyntaxTree(){
		left = NULL;
		right = NULL;
		expressionReturnType = NULL;
		inner.sym = NULL;
		nodeFlags = NO_FLAGS;
	}


	unsigned int SyntaxTree::getReturnSize(){
		switch(nodeType){
		case NODE_EXPRESSION:
			return expressionReturnType->size;
			break;
		case NODE_TOKEN:
			return inner.nodeToken.innerType->size;
			break;

		case NODE_SYMBOL:
			return inner.sym->type.size;
			break;
		default:
			// TODO: Something good!
			throw ParserException("INVALID RETURNSIZE");
		}
	}
}